import org.openjdk.btrace.core.annotations.*;

import static org.openjdk.btrace.core.BTraceUtils.identityStr;
import static org.openjdk.btrace.core.BTraceUtils.println;

@BTrace
public class AllSync {
    @OnMethod(
            clazz = "/.*/",
            method = "/.*/",
            location = @Location(value = Kind.SYNC_ENTRY, where = Where.AFTER)
    )
    public static void onSyncEntry(Object obj) {
        println("after synchronized entry: " + identityStr(obj));
    }

    @OnMethod(
            clazz = "/.*/",
            method = "/.*/",
            location = @Location(Kind.SYNC_EXIT)
    )
    public static void onSyncExit(Object obj) {
        println("before synchronized exit: " + identityStr(obj));
    }
}
